//
//  WoShouDetailInfoCell.m
//  ReceiptDelivery
//
//  Created by 吕晶 on 2020/10/13.
//  Copyright © 2020 吕晶. All rights reserved.
//

#import "WoShouDetailInfoCell.h"

@interface WoShouDetailInfoCell ()

@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UILabel *noTitleLab;
@property (nonatomic, strong) UILabel *noLab;
@property (nonatomic, strong) UIButton *erWeiMaBtn;
@property (nonatomic, strong) UILabel *faYunTitleLab;
@property (nonatomic, strong) UILabel *faYunLab;
@property (nonatomic, strong) UIButton *faPhoneBtn;
@property (nonatomic, strong) UILabel *chengYunTitleLab;
@property (nonatomic, strong) UILabel *chengYunLab;
@property (nonatomic, strong) UIButton *phoneBtn;
@property (nonatomic, strong) UILabel *line1;

@property (nonatomic, strong) UIImageView *tiImgView;
@property (nonatomic, strong) UIScrollView *faHuoAddressScrollView;
@property (nonatomic, strong) UILabel *marginLine2;
@property (nonatomic, strong) UIImageView *shouImgView;
@property (nonatomic, strong) UILabel *shouNameLab;
@property (nonatomic, strong) UILabel *shouPhoneLab;
@property (nonatomic, strong) UILabel *shouAddressLab;
@property (nonatomic, strong) UILabel *shouCompanyLab;
@property (nonatomic, strong) UILabel *marginLine3;
@property (nonatomic, strong) UILabel *linkLine;

@property (nonatomic, strong) UILabel *linkOrderTitleLab;
@property (nonatomic, strong) UILabel *linkOrderLab;
@property (nonatomic, strong) UILabel *yaoQiuTitleLab;
@property (nonatomic, strong) UILabel *yaoQiuLab;
@property (nonatomic, strong) UILabel *weightTitleLab;
@property (nonatomic, strong) UILabel *weightLab;
@property (nonatomic, strong) UILabel *tiJiTitleLab;
@property (nonatomic, strong) UILabel *tiJiLab;
@property (nonatomic, strong) UILabel *jiFeiWeightTitleLab;
@property (nonatomic, strong) UILabel *jiFeiWeightLab;
@property (nonatomic, strong) UILabel *jiFeiTiJiTitleLab;
@property (nonatomic, strong) UILabel *jiFeiTiJiLab;
@property (nonatomic, strong) UILabel *baoXianTitleLab;
@property (nonatomic, strong) UILabel *baoXianLab;

@property (nonatomic, strong) UILabel *fuWuTitleLab;
@property (nonatomic, strong) UILabel *fuWuLab;
@property (nonatomic, strong) UILabel *yunShuShiXiaoTitleLab;
@property (nonatomic, strong) UILabel *yunShuShiXiaoLab;
@property (nonatomic, strong) UILabel *yunShuFangShiTitleLab;
@property (nonatomic, strong) UILabel *yunShuFangShiLab;
@property (nonatomic, strong) UILabel *jieSuanTitleLab;
@property (nonatomic, strong) UILabel *jieSuanLab;
@property (nonatomic, strong) UILabel *carTitleLab;
@property (nonatomic, strong) UILabel *carLab;
@property (nonatomic, strong) UILabel *huiDanTitleLab;
@property (nonatomic, strong) UILabel *huiDanLab;
@property (nonatomic, strong) UILabel *fileTitleLab;
@property (nonatomic, strong) UILabel *fileLab;
@property (nonatomic, strong) UILabel *remarkTitleLab;
@property (nonatomic, strong) UILabel *remarkLab;

@end

@implementation WoShouDetailInfoCell

+ (instancetype)WoShouDetailInfoCellWithTableView:(UITableView *)tableView {
    static NSString *cellID = @"WoShouDetailInfoCell";
    WoShouDetailInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[WoShouDetailInfoCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = Color_backgroundColor;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.bgView = [UIView new];
        self.bgView.backgroundColor = HexColor(0xffffff);
        self.bgView.layer.masksToBounds = YES;
        self.bgView.layer.cornerRadius = 6;
        [self.contentView addSubview:self.bgView];
        
        self.noTitleLab = [UILabel new];
        self.noTitleLab.textColor = HexColor(0x9C9DB3);
        self.noTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.noTitleLab];
        
        self.noLab = [UILabel new];
        self.noLab.textColor = HexColor(0x2B2C44);
        self.noLab.font = BoldFontOfSize(14);
        self.noLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.noLab];
        
        self.erWeiMaBtn = [UIButton new];
        [self.bgView addSubview:self.erWeiMaBtn];
        
        self.faYunTitleLab = [UILabel new];
        self.faYunTitleLab.textColor = HexColor(0x9C9DB3);
        self.faYunTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.faYunTitleLab];
        
        self.faYunLab = [UILabel new];
        self.faYunLab.textColor = HexColor(0x2B2C44);
        self.faYunLab.font = [UIFont systemFontOfSize:14];
        self.faYunLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.faYunLab];
        
        self.faPhoneBtn = [UIButton new];
        [self.faPhoneBtn addTarget:self action:@selector(faPhoneClick) forControlEvents:UIControlEventTouchUpInside];
        [self.bgView addSubview:self.faPhoneBtn];
        
        self.chengYunTitleLab = [UILabel new];
        self.chengYunTitleLab.textColor = HexColor(0x9C9DB3);
        self.chengYunTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.chengYunTitleLab];
        
        self.chengYunLab = [UILabel new];
        self.chengYunLab.textColor = HexColor(0x2B2C44);
        self.chengYunLab.font = [UIFont systemFontOfSize:14];
        self.chengYunLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.chengYunLab];
        
        self.phoneBtn = [UIButton new];
        [self.phoneBtn addTarget:self action:@selector(chengPhoneClick) forControlEvents:UIControlEventTouchUpInside];
        [self.bgView addSubview:self.phoneBtn];
        
        self.line1 = [UILabel new];
        self.line1.backgroundColor = HexColor(0xF2F2F5);
        [self.bgView addSubview:self.line1];
        
        self.tiImgView = [UIImageView new];
        self.tiImgView.image = [UIImage imageNamed:@"icon_add_ti"];
        [self.bgView addSubview:self.tiImgView];
        
        self.faHuoAddressScrollView = [UIScrollView new];
        [self.bgView addSubview:self.faHuoAddressScrollView];
        
        self.marginLine2 = [UILabel new];
        self.marginLine2.backgroundColor = Color_backgroundColor;
        [self.bgView addSubview:self.marginLine2];
        
        self.shouImgView = [UIImageView new];
        self.shouImgView.image = [UIImage imageNamed:@"icon_add_shou"];
        [self.bgView addSubview:self.shouImgView];
        
        self.shouNameLab = [UILabel new];
        self.shouNameLab.textColor = HexColor(0x2B2C44);
        self.shouNameLab.font = BoldFontOfSize(16);
        [self.bgView addSubview:self.shouNameLab];
        
        self.shouPhoneLab = [UILabel new];
        self.shouPhoneLab.textColor = Color_ThemeColor;
        self.shouPhoneLab.font = BoldFontOfSize(16);
        [self.bgView addSubview:self.shouPhoneLab];
        
        self.shouAddressLab = [UILabel new];
        self.shouAddressLab.textColor = HexColor(0x9C9DB3);
        self.shouAddressLab.font = [UIFont systemFontOfSize:14];
        self.shouAddressLab.numberOfLines = 0;
        [self.bgView addSubview:self.shouAddressLab];
        
        self.shouCompanyLab = [UILabel new];
        self.shouCompanyLab.textColor = HexColor(0x9C9DB3);
        self.shouCompanyLab.font = [UIFont systemFontOfSize:14];
        self.shouCompanyLab.numberOfLines = 0;
        [self.bgView addSubview:self.shouCompanyLab];
        
        self.marginLine3 = [UILabel new];
        self.marginLine3.backgroundColor = Color_backgroundColor;
        [self.bgView addSubview:self.marginLine3];
        
        self.linkLine = [UILabel new];
        self.linkLine.backgroundColor = HexColorA(0x3D68EB, 0.2);
        [self.bgView addSubview:self.linkLine];
        
        self.linkOrderTitleLab = [UILabel new];
        self.linkOrderTitleLab.textColor = HexColor(0x9C9DB3);
        self.linkOrderTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.linkOrderTitleLab];
        
        self.linkOrderLab = [UILabel new];
        self.linkOrderLab.textColor = HexColor(0x2B2C44);
        self.linkOrderLab.font = [UIFont systemFontOfSize:14];
        self.linkOrderLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.linkOrderLab];
        
        self.yaoQiuTitleLab = [UILabel new];
        self.yaoQiuTitleLab.textColor = HexColor(0x9C9DB3);
        self.yaoQiuTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.yaoQiuTitleLab];
        
        self.yaoQiuLab = [UILabel new];
        self.yaoQiuLab.textColor = HexColor(0x2B2C44);
        self.yaoQiuLab.font = [UIFont systemFontOfSize:14];
        self.yaoQiuLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.yaoQiuLab];
        
        self.weightTitleLab = [UILabel new];
        self.weightTitleLab.textColor = HexColor(0x9C9DB3);
        self.weightTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.weightTitleLab];
        
        self.weightLab = [UILabel new];
        self.weightLab.textColor = HexColor(0x2B2C44);
        self.weightLab.font = [UIFont systemFontOfSize:14];
        self.weightLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.weightLab];
        
        self.tiJiTitleLab = [UILabel new];
        self.tiJiTitleLab.textColor = HexColor(0x9C9DB3);
        self.tiJiTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.tiJiTitleLab];
        
        self.tiJiLab = [UILabel new];
        self.tiJiLab.textColor = HexColor(0x2B2C44);
        self.tiJiLab.font = [UIFont systemFontOfSize:14];
        self.tiJiLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.tiJiLab];
        
        self.jiFeiWeightTitleLab = [UILabel new];
        self.jiFeiWeightTitleLab.textColor = HexColor(0x9C9DB3);
        self.jiFeiWeightTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.jiFeiWeightTitleLab];
        
        self.jiFeiWeightLab = [UILabel new];
        self.jiFeiWeightLab.textColor = HexColor(0x2B2C44);
        self.jiFeiWeightLab.font = [UIFont systemFontOfSize:14];
        self.jiFeiWeightLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.jiFeiWeightLab];
        
        self.jiFeiTiJiTitleLab = [UILabel new];
        self.jiFeiTiJiTitleLab.textColor = HexColor(0x9C9DB3);
        self.jiFeiTiJiTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.jiFeiTiJiTitleLab];
        
        self.jiFeiTiJiLab = [UILabel new];
        self.jiFeiTiJiLab.textColor = HexColor(0x2B2C44);
        self.jiFeiTiJiLab.font = [UIFont systemFontOfSize:14];
        self.jiFeiTiJiLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.jiFeiTiJiLab];
        
        self.baoXianTitleLab = [UILabel new];
        self.baoXianTitleLab.textColor = HexColor(0x9C9DB3);
        self.baoXianTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.baoXianTitleLab];
        
        self.baoXianLab = [UILabel new];
        self.baoXianLab.textColor = HexColor(0x2B2C44);
        self.baoXianLab.font = [UIFont systemFontOfSize:14];
        self.baoXianLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.baoXianLab];
        
        self.fuWuTitleLab = [UILabel new];
        self.fuWuTitleLab.textColor = HexColor(0x9C9DB3);
        self.fuWuTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.fuWuTitleLab];
        
        self.fuWuLab = [UILabel new];
        self.fuWuLab.textColor = HexColor(0x2B2C44);
        self.fuWuLab.font = [UIFont systemFontOfSize:14];
        self.fuWuLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.fuWuLab];
        
        self.yunShuShiXiaoTitleLab = [UILabel new];
        self.yunShuShiXiaoTitleLab.textColor = HexColor(0x9C9DB3);
        self.yunShuShiXiaoTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.yunShuShiXiaoTitleLab];
        
        self.yunShuShiXiaoLab = [UILabel new];
        self.yunShuShiXiaoLab.textColor = HexColor(0x2B2C44);
        self.yunShuShiXiaoLab.font = [UIFont systemFontOfSize:14];
        self.yunShuShiXiaoLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.yunShuShiXiaoLab];
        
        self.yunShuFangShiTitleLab = [UILabel new];
        self.yunShuFangShiTitleLab.textColor = HexColor(0x9C9DB3);
        self.yunShuFangShiTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.yunShuFangShiTitleLab];
        
        self.yunShuFangShiLab = [UILabel new];
        self.yunShuFangShiLab.textColor = HexColor(0x2B2C44);
        self.yunShuFangShiLab.font = [UIFont systemFontOfSize:14];
        self.yunShuFangShiLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.yunShuFangShiLab];
        
        self.jieSuanTitleLab = [UILabel new];
        self.jieSuanTitleLab.textColor = HexColor(0x9C9DB3);
        self.jieSuanTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.jieSuanTitleLab];
        
        self.jieSuanLab = [UILabel new];
        self.jieSuanLab.textColor = HexColor(0x2B2C44);
        self.jieSuanLab.font = [UIFont systemFontOfSize:14];
        self.jieSuanLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.jieSuanLab];
        
        self.carTitleLab = [UILabel new];
        self.carTitleLab.textColor = HexColor(0x9C9DB3);
        self.carTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.carTitleLab];
        
        self.carLab = [UILabel new];
        self.carLab.textColor = HexColor(0x2B2C44);
        self.carLab.font = [UIFont systemFontOfSize:14];
        self.carLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.carLab];
        
        self.huiDanTitleLab = [UILabel new];
        self.huiDanTitleLab.textColor = HexColor(0x9C9DB3);
        self.huiDanTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.huiDanTitleLab];
        
        self.huiDanLab = [UILabel new];
        self.huiDanLab.textColor = HexColor(0x2B2C44);
        self.huiDanLab.font = [UIFont systemFontOfSize:14];
        self.huiDanLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.huiDanLab];
        
        self.fileTitleLab = [UILabel new];
        self.fileTitleLab.textColor = HexColor(0x9C9DB3);
        self.fileTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.fileTitleLab];
        
        self.fileLab = [UILabel new];
        self.fileLab.textColor = HexColor(0x2B2C44);
        self.fileLab.font = [UIFont systemFontOfSize:14];
        self.fileLab.textAlignment = NSTextAlignmentRight;
        self.fileLab.numberOfLines = 0;
        [self.bgView addSubview:self.fileLab];
        
        self.remarkTitleLab = [UILabel new];
        self.remarkTitleLab.textColor = HexColor(0x9C9DB3);
        self.remarkTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.remarkTitleLab];
        
        self.remarkLab = [UILabel new];
        self.remarkLab.textColor = HexColor(0x2B2C44);
        self.remarkLab.font = [UIFont systemFontOfSize:14];
        self.remarkLab.textAlignment = NSTextAlignmentRight;
        self.remarkLab.numberOfLines = 0;
        [self.bgView addSubview:self.remarkLab];
    }
    return self;
}

- (void)faPhoneClick {
    
}

- (void)chengPhoneClick {
    
}

-(void)setModel:(WoFaYunDetailModel *)model {
    _model = model;
    [self configUI];
}

- (void)configUI {
    self.bgView.nim_left = 15;
    self.bgView.nim_top = 10;
    self.bgView.nim_width = ScreenW - 2 * self.bgView.nim_left;
    
    self.noTitleLab.text = @"运单号：";
    self.noTitleLab.nim_left = 15;
    self.noTitleLab.nim_top = 20;
    [self.noTitleLab sizeToFit];
    
    self.noLab.text = self.model.wa_num;
    [self.noLab sizeToFit];
    self.noLab.nim_left = self.bgView.nim_width - 15 - 6 - 18 - self.noLab.nim_width;
    self.noLab.nim_centerY = self.noTitleLab.nim_centerY;
    
    self.erWeiMaBtn.nim_left = self.noLab.nim_right + 6;
    self.erWeiMaBtn.nim_width = 18;
    self.erWeiMaBtn.nim_height = 18;
    self.erWeiMaBtn.nim_centerY = self.noLab.nim_centerY;
    [self.erWeiMaBtn setImage:[UIImage imageNamed:@"icon_ladingbill_erweima"] forState:0];
    
    self.faYunTitleLab.text = @"发运方：";
    self.faYunTitleLab.nim_left = 15;
    self.faYunTitleLab.nim_top = self.noTitleLab.nim_bottom + 15;
    [self.faYunTitleLab sizeToFit];
    
    self.faYunLab.text = self.model.s_name;
    [self.faYunLab sizeToFit];
    self.faYunLab.nim_left = self.faYunTitleLab.nim_right;
    self.faYunLab.nim_width = self.bgView.nim_width - 15 - 10 - 30 - self.faYunLab.nim_left;
    self.faYunLab.nim_centerY = self.faYunTitleLab.nim_centerY;
    
    self.faPhoneBtn.nim_width = 30;
    self.faPhoneBtn.nim_height = 30;
    self.faPhoneBtn.nim_left = self.faYunLab.nim_right + 10;
    self.faPhoneBtn.nim_centerY = self.faYunTitleLab.nim_centerY;
    [self.faPhoneBtn setImage:[UIImage imageNamed:@"wofayun_phone_btn"] forState:0];
    
    self.chengYunTitleLab.text = @"承运方：";
    self.chengYunTitleLab.nim_left = 15;
    self.chengYunTitleLab.nim_top = self.faYunTitleLab.nim_bottom + 15;
    [self.chengYunTitleLab sizeToFit];
    
    self.chengYunLab.text = self.model.tlogistics_name;
    [self.chengYunLab sizeToFit];
    self.chengYunLab.nim_left = self.chengYunTitleLab.nim_right;
    self.chengYunLab.nim_width = self.bgView.nim_width - 15 - 10 - 30 - self.chengYunLab.nim_left;
    self.chengYunLab.nim_centerY = self.chengYunTitleLab.nim_centerY;
    
    self.phoneBtn.nim_width = 30;
    self.phoneBtn.nim_height = 30;
    self.phoneBtn.nim_left = self.chengYunLab.nim_right + 10;
    self.phoneBtn.nim_centerY = self.chengYunTitleLab.nim_centerY;
    [self.phoneBtn setImage:[UIImage imageNamed:@"wofayun_phone_btn"] forState:0];
    
    self.line1.frame = CGRectMake(0, self.chengYunTitleLab.nim_bottom + 20, self.bgView.nim_width, 2);
    
    self.faHuoAddressScrollView.frame = CGRectMake(59, 15 + self.line1.nim_bottom, self.bgView.nim_width - 59, 67);
    CGFloat scrConW = self.bgView.nim_width - 71 - 59;
    self.faHuoAddressScrollView.contentSize = CGSizeMake(scrConW * self.model.warehouse.count, 67);
    [self.faHuoAddressScrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
    __block CGFloat scrConLeft = 0;
    [self.model.warehouse enumerateObjectsUsingBlock:^(WoFaYunDetailTiHuoAddressModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(scrConLeft, 0, scrConW, 67)];
        scrConLeft = view.nim_right;
        
        UILabel *tiNameLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 2.5, scrConW - 10, 17)];
        tiNameLab.textColor = HexColor(0x2B2C44);
        tiNameLab.font = BoldFontOfSize(16);
        tiNameLab.text = [NSString stringWithFormat:@"%@ %@",obj.contract_name,obj.contract_tel];
        [view addSubview:tiNameLab];
        
        UILabel *tiAddressLab = [[UILabel alloc] initWithFrame:CGRectMake(0, tiNameLab.nim_bottom + 10, tiNameLab.nim_width, 15)];
        tiAddressLab.textColor = HexColor(0x9C9DB3);
        tiAddressLab.font = [UIFont systemFontOfSize:14];
        tiAddressLab.text = obj.info;
        [view addSubview:tiAddressLab];
        
        UILabel * tiCompanyLab = [[UILabel alloc] initWithFrame:CGRectMake(0, tiAddressLab.nim_bottom + 5, tiAddressLab.nim_width, 15)];
        tiCompanyLab.textColor = HexColor(0x9C9DB3);
        tiCompanyLab.font = [UIFont systemFontOfSize:14];
        tiCompanyLab.text = obj.name;
        [view addSubview:tiCompanyLab];
        
        [self.faHuoAddressScrollView addSubview:view];
    }];
    
    self.marginLine2.frame = CGRectMake(52, 92 + self.line1.nim_bottom, self.bgView.nim_width - 52, 1);

    self.shouNameLab.text = [NSString stringWithFormat:@"%@ %@",self.model.saddress.contract_name,self.model.saddress.contract_tel];
    [self.shouNameLab sizeToFit];
    self.shouNameLab.nim_left = 59;
    self.shouNameLab.nim_top = 10 + self.marginLine2.nim_bottom;
    self.shouNameLab.nim_width = self.bgView.nim_width - 70 - 10 - self.shouNameLab.nim_left;
    
    self.shouAddressLab.nim_width = self.shouNameLab.nim_width;
    self.shouAddressLab.text = self.model.saddress.info;
    self.shouAddressLab.nim_left = self.shouNameLab.nim_left;
    self.shouAddressLab.nim_top = self.shouNameLab.nim_bottom + 10;
    [self.shouAddressLab sizeToFit];
    self.shouAddressLab.nim_width = self.shouNameLab.nim_width;
    
    self.shouCompanyLab.nim_width = self.shouAddressLab.nim_width;
    self.shouCompanyLab.text = self.model.saddress.name;
    self.shouCompanyLab.nim_left = self.shouAddressLab.nim_left;
    self.shouCompanyLab.nim_top = self.shouAddressLab.nim_bottom + 5;
    [self.shouCompanyLab sizeToFit];
    self.shouCompanyLab.nim_width = self.shouAddressLab.nim_width;
    
    self.marginLine3.nim_left = 0;
    self.marginLine3.nim_top = self.shouCompanyLab.nim_bottom + 15;
    self.marginLine3.nim_width = self.bgView.nim_width;
    self.marginLine3.nim_height = 2;
    
    self.tiImgView.nim_width = 22;
    self.tiImgView.nim_height = 22;
    self.tiImgView.nim_left = 20;
    self.tiImgView.nim_top = (self.marginLine2.nim_top - self.line1.nim_bottom - self.tiImgView.nim_width) * 0.5 + self.line1.nim_bottom;
    
    self.shouImgView.nim_width = 22;
    self.shouImgView.nim_height = 22;
    self.shouImgView.nim_left = 20;
    self.shouImgView.nim_top = (self.marginLine3.nim_top - self.marginLine2.nim_bottom - self.shouImgView.nim_height) * 0.5 + self.marginLine2.nim_bottom;
    
    self.linkLine.nim_width = 2;
    self.linkLine.nim_top = self.tiImgView.nim_bottom + 3;
    self.linkLine.nim_height = self.shouImgView.nim_top - 3 - self.linkLine.nim_top;
    self.linkLine.nim_centerX = self.tiImgView.nim_centerX;
    
    self.linkOrderTitleLab.text = @"关联订单：";
    self.linkOrderTitleLab.nim_left = 15;
    self.linkOrderTitleLab.nim_top = 20 + self.marginLine3.nim_bottom;
    [self.linkOrderTitleLab sizeToFit];
    
    self.linkOrderLab.text = self.model.aorder;
    [self.linkOrderLab sizeToFit];
    self.linkOrderLab.nim_left = self.bgView.nim_width - 15 - self.linkOrderLab.nim_width;
    self.linkOrderLab.nim_centerY = self.linkOrderTitleLab.nim_centerY;
    
    self.yaoQiuTitleLab.text = @"要求到达时间：";
    self.yaoQiuTitleLab.nim_left = 15;
    self.yaoQiuTitleLab.nim_top = 10 + self.linkOrderTitleLab.nim_bottom;
    [self.yaoQiuTitleLab sizeToFit];
    
    self.yaoQiuLab.text = self.model.demandTime;
    [self.yaoQiuLab sizeToFit];
    self.yaoQiuLab.nim_left = self.bgView.nim_width - 15 - self.yaoQiuLab.nim_width;
    self.yaoQiuLab.nim_centerY = self.yaoQiuTitleLab.nim_centerY;
    
    self.weightTitleLab.text = @"总重量(kg)：";
    self.weightTitleLab.nim_left = 15;
    self.weightTitleLab.nim_top = 10 + self.yaoQiuTitleLab.nim_bottom;
    [self.weightTitleLab sizeToFit];
    
    self.weightLab.text = self.model.allWeight;
    [self.weightLab sizeToFit];
    self.weightLab.nim_left = self.bgView.nim_width - 15 - self.weightLab.nim_width;
    self.weightLab.nim_centerY = self.weightTitleLab.nim_centerY;
    
    self.tiJiTitleLab.text = @"总体积(m³)：";
    self.tiJiTitleLab.nim_left = 15;
    self.tiJiTitleLab.nim_top = 10 + self.weightTitleLab.nim_bottom;
    [self.tiJiTitleLab sizeToFit];
    
    self.tiJiLab.text = self.model.allVolume;
    [self.tiJiLab sizeToFit];
    self.tiJiLab.nim_left = self.bgView.nim_width - 15 - self.tiJiLab.nim_width;
    self.tiJiLab.nim_centerY = self.tiJiTitleLab.nim_centerY;
    
    self.jiFeiWeightTitleLab.text = @"计费重量(kg)：";
    self.jiFeiWeightTitleLab.nim_left = 15;
    self.jiFeiWeightTitleLab.nim_top = 10 + self.tiJiTitleLab.nim_bottom;
    [self.jiFeiWeightTitleLab sizeToFit];
    
    self.jiFeiWeightLab.text = self.model.costWeight;
    [self.jiFeiWeightLab sizeToFit];
    self.jiFeiWeightLab.nim_left = self.bgView.nim_width - 15 - self.jiFeiWeightLab.nim_width;
    self.jiFeiWeightLab.nim_centerY = self.jiFeiWeightTitleLab.nim_centerY;
    
    self.jiFeiTiJiTitleLab.text = @"计费体积(m³)：";
    self.jiFeiTiJiTitleLab.nim_left = 15;
    self.jiFeiTiJiTitleLab.nim_top = 10 + self.jiFeiWeightTitleLab.nim_bottom;
    [self.jiFeiTiJiTitleLab sizeToFit];
    
    self.jiFeiTiJiLab.text = self.model.costVolume;
    [self.jiFeiTiJiLab sizeToFit];
    self.jiFeiTiJiLab.nim_left = self.bgView.nim_width - 15 - self.jiFeiTiJiLab.nim_width;
    self.jiFeiTiJiLab.nim_centerY = self.jiFeiTiJiTitleLab.nim_centerY;
    
    self.baoXianTitleLab.text = @"保险声明价值(元)：";
    self.baoXianTitleLab.nim_left = 15;
    self.baoXianTitleLab.nim_top = 10 + self.jiFeiTiJiTitleLab.nim_bottom;
    [self.baoXianTitleLab sizeToFit];
    
    self.baoXianLab.text = self.model.price;
    [self.baoXianLab sizeToFit];
    self.baoXianLab.nim_left = self.bgView.nim_width - 15 - self.baoXianLab.nim_width;
    self.baoXianLab.nim_centerY = self.baoXianTitleLab.nim_centerY;
    
    self.fuWuTitleLab.text = @"服务方式：";
    self.fuWuTitleLab.nim_left = 15;
    self.fuWuTitleLab.nim_top = 10 + self.baoXianTitleLab.nim_bottom;
    [self.fuWuTitleLab sizeToFit];
    
    self.fuWuLab.text = self.model.delivery;
    [self.fuWuLab sizeToFit];
    self.fuWuLab.nim_left = self.bgView.nim_width - 15 - self.fuWuLab.nim_width;
    self.fuWuLab.nim_centerY = self.fuWuTitleLab.nim_centerY;
    
    self.yunShuShiXiaoTitleLab.text = @"运输时效：";
    self.yunShuShiXiaoTitleLab.nim_left = 15;
    self.yunShuShiXiaoTitleLab.nim_top = 10 + self.fuWuTitleLab.nim_bottom;
    [self.yunShuShiXiaoTitleLab sizeToFit];
    
    self.yunShuShiXiaoLab.text = self.model.tsTime;
    [self.yunShuShiXiaoLab sizeToFit];
    self.yunShuShiXiaoLab.nim_left = self.bgView.nim_width - 15 - self.yunShuShiXiaoLab.nim_width;
    self.yunShuShiXiaoLab.nim_centerY = self.yunShuShiXiaoTitleLab.nim_centerY;
    
    self.yunShuFangShiTitleLab.text = @"运输方式：";
    self.yunShuFangShiTitleLab.nim_left = 15;
    self.yunShuFangShiTitleLab.nim_top = 10 + self.yunShuShiXiaoTitleLab.nim_bottom;
    [self.yunShuFangShiTitleLab sizeToFit];
    
    self.yunShuFangShiLab.text = self.model.transport;
    [self.yunShuFangShiLab sizeToFit];
    self.yunShuFangShiLab.nim_left = self.bgView.nim_width - 15 - self.yunShuFangShiLab.nim_width;
    self.yunShuFangShiLab.nim_centerY = self.yunShuFangShiTitleLab.nim_centerY;
    
    self.jieSuanTitleLab.text = @"结算方式：";
    self.jieSuanTitleLab.nim_left = 15;
    self.jieSuanTitleLab.nim_top = 10 + self.yunShuFangShiTitleLab.nim_bottom;
    [self.jieSuanTitleLab sizeToFit];
    
    self.jieSuanLab.text = self.model.settleSty;
    [self.jieSuanLab sizeToFit];
    self.jieSuanLab.nim_left = self.bgView.nim_width - 15 - self.jieSuanLab.nim_width;
    self.jieSuanLab.nim_centerY = self.jieSuanTitleLab.nim_centerY;
    
    self.carTitleLab.text = @"车辆要求：";
    self.carTitleLab.nim_left = 15;
    self.carTitleLab.nim_top = 10 + self.jieSuanTitleLab.nim_bottom;
    [self.carTitleLab sizeToFit];
    
    self.carLab.text = self.model.needCar;
    [self.carLab sizeToFit];
    self.carLab.nim_left = self.bgView.nim_width - 15 - self.carLab.nim_width;
    self.carLab.nim_centerY = self.carTitleLab.nim_centerY;
    
    self.huiDanTitleLab.text = @"是否需要回单上缴：";
    self.huiDanTitleLab.nim_left = 15;
    self.huiDanTitleLab.nim_top = 10 + self.carTitleLab.nim_bottom;
    [self.huiDanTitleLab sizeToFit];
    
    self.huiDanLab.text = self.model.isTurn_name;
    [self.huiDanLab sizeToFit];
    self.huiDanLab.nim_left = self.bgView.nim_width - 15 - self.huiDanLab.nim_width;
    self.huiDanLab.nim_centerY = self.huiDanTitleLab.nim_centerY;
    
    self.fileTitleLab.nim_left = 15;
    self.fileTitleLab.nim_top = self.huiDanTitleLab.nim_bottom + 10;
    self.fileTitleLab.text = @"随附文件：";
    [self.fileTitleLab sizeToFit];
    
    self.fileLab.nim_left = self.fileTitleLab.nim_right + 10;
    self.fileLab.nim_top = self.fileTitleLab.nim_top;
    self.fileLab.nim_width = self.bgView.nim_width - 15 - self.fileLab.nim_left;
    self.fileLab.text = self.model.fileInfo;
    [self.fileLab sizeToFit];
    self.fileLab.nim_width = self.bgView.nim_width - 15 - self.fileLab.nim_left;
    
    self.remarkTitleLab.nim_left = 15;
    self.remarkTitleLab.nim_top = (self.model.fileInfo.length ? self.fileLab.nim_bottom : self.fileTitleLab.nim_bottom) + 10;
    self.remarkTitleLab.text = @"备注：";
    [self.remarkTitleLab sizeToFit];
    
    self.remarkLab.nim_left = self.remarkTitleLab.nim_right + 10;
    self.remarkLab.nim_top = self.remarkTitleLab.nim_top;
    self.remarkLab.nim_width = self.bgView.nim_width - 15 - self.remarkLab.nim_left;
    self.remarkLab.text = self.model.remarks;
    [self.remarkLab sizeToFit];
    self.remarkLab.nim_width = self.bgView.nim_width - 15 - self.remarkLab.nim_left;
    
    self.bgView.nim_height = (self.model.remarks.length ? self.remarkLab.nim_bottom : self.remarkTitleLab.nim_bottom) + 20;
    
    self.height = self.bgView.nim_bottom;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
